<!DOCTYPE html>
<html lang="en">
<head>
    <meta charset="UTF-8">
    <meta name="viewport" content="width=device-width, initial-scale=1.0">
    <title>Document</title>
    <style>
        input{
            width: 300px;
            height: 30px;
            border: 1px solid #ccc;
            border-radius: 3px;
        }
    </style>
</head>
<body>
    <input type="text" id="text" placeholder="请输入内容" onblur="hidden" onfocus="focus">
    <script>
        function focus(){
            const text1=document.getElementById('text');
            const placeholderText=text1.Placeholder;
            if(text1.value===placeholderText){
                text1.value='';
            }
        }
        function hidden(){
            const text1=document.getElementById('text');
            const placeholderText=text1.Placeholder;
            if(text1.value===''){
                text1.value=placeholderText;
            }
        }
    </script>
</body>
</html>